#include <stdio.h>
#include <riscv_vector.h>

void vector_add_e32m1(uint32_t *c, uint32_t *a, uint32_t *b, int n);

#define N 200
int main() {
	int i;
	uint32_t a[N] = {0};
	uint32_t b[N] = {0};
	uint32_t c[N] = {0};

	for(i = 0; i < N; i++) {
		a[i] = i;
		b[i] = 2*i;
	}

	vector_add_e32m1(c, a, b, N);

	// check the result
	for (i = 0; i < N; ++i) {
		if (c[i] != a[i] + b[i]) {
			printf("Result error, invalid result at index: %d\n", i);
			break;
		}
	}

	if (i >= N) {
		printf("The result is correct\n");
	}


	int dump_num = 10;
	if (N < 10) {
		dump_num = N;
	}

	printf("Dump a portion of the data: ");
	for(i = 0; i < dump_num; i++) {
		printf("%d ", c[i]);
	}

	printf("\n");

	return 0;
}
